package com.caigou.modules.forum.adpter

import android.text.TextUtils
import com.caigou.comm.base.utils.ImageLoader
import com.caigou.modules.forum.R
import com.caigou.modules.forum.bean.UserItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2021/11/20
 */
class UserItemAdapter(dataset: MutableList<UserItemBean>) : BaseQuickAdapter<UserItemBean, BaseViewHolder>(R.layout.item_user_list, dataset), LoadMoreModule {

    override fun convert(holder: BaseViewHolder, item: UserItemBean) {
        if (TextUtils.isEmpty(item.headImg)) {
            holder.setImageResource(R.id.item_user_iv_avatar, R.drawable.img_comm_avatar)
        } else {
            ImageLoader.loadCircle(context, item.headImg, holder.getView(R.id.item_user_iv_avatar))
        }

        holder.setText(R.id.item_user_tv_nickname, item.nickName)
        holder.setText(R.id.item_user_tv_post_num, "发布帖子数：${item.posts}")
        holder.setText(R.id.item_user_tv_fans_num, "关注粉丝：${item.fansCount}")
        holder.setText(R.id.item_user_tv_nice_num, "获赞数：${item.winNicePoint}")

    }
}